package me.shep.wishlist.client.RPC;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

import me.shep.wishlist.client.DesiredItem;
import me.shep.wishlist.client.Person;

public interface InventoryServiceAsync {
	void login(String token, AsyncCallback<Person> callback);
	void logout(String token, AsyncCallback callback);
	void getPeople(String token, AsyncCallback<List<Person>> callback);
	void updateItem(DesiredItem d, String token, AsyncCallback callback);
	void deleteItem(int id, String token, AsyncCallback callback);
	void addItem(DesiredItem d, String token, AsyncCallback callback);
	void purchaseItem(int id, String token, AsyncCallback callback);
	
	   //
	   //
	   // Service implementation singleton
	   //
	   //
	   
	   //public static final String ENTRY_POINT = GWT.getModuleBaseURL() + "Inventorys";
	   
	   public static final InventoryServiceAsync impl = Impl.getInstance();

	   class Impl
	   {

	      private InventoryServiceAsync instance;
	      private static Impl impl;

	      private Impl()
	      {
	         instance = (InventoryServiceAsync) GWT.create(InventoryService.class);
	         //((ServiceDefTarget) instance).setServiceEntryPoint(ENTRY_POINT);
	      }

	      public static InventoryServiceAsync getInstance()
	      {
	         if (impl == null) impl = new Impl();
	         return impl.instance;
	      }

	   }

}
